package org.dromara.system.business.cases.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.system.business.cases.mapper.CaseManagerMapper;
import org.dromara.system.business.cases.entity.CaseManager;
import org.dromara.system.business.cases.select.CaseSelect;
import org.dromara.system.business.cases.service.CaseManagerService;
import org.dromara.system.business.common.PageVo;
import org.springframework.stereotype.Service;

/**
 * (CaseManager)表服务实现类
 *
 * @author zms
 * @since 2025-02-08 14:56:39
 */
@Service
public class CaseManagerServiceImpl extends ServiceImpl<CaseManagerMapper, CaseManager> implements CaseManagerService {

    @Override
    public Page<CaseManager> getPages(PageVo pageVo, CaseSelect caseSelect) {
        Page<CaseManager> page = new Page<>(pageVo.getPageNum(), pageVo.getPageSize());
        LambdaQueryWrapper<CaseManager> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(StringUtils.isNotEmpty(caseSelect.getName()), CaseManager::getName, caseSelect.getName());
        wrapper.eq(StringUtils.isNotEmpty(caseSelect.getType()), CaseManager::getType, caseSelect.getType());
        wrapper.between(StringUtils.isNotEmpty(caseSelect.getBeginTime()) && StringUtils.isNotEmpty(caseSelect.getEndTime()), CaseManager::getReleaseTime, caseSelect.getBeginTime(), caseSelect.getEndTime());

        return null;
    }
}

